import Head from 'next/head'
import { useEffect, useState } from 'react'

export default () =>{
  // console.log('index render')

  const [advs, setAdvs] = useState([])
  useEffect(() => {
    setAdvs([
      {
        link:"baidu.com", name: '百度',
      },
      {
        link:"sina.com", name: '新浪'
      },
      {
        link:"weibo.com", name: '微博'
      }
    ])
  }, [])

  return <div>
    <Head>
      <title>首页</title>
      <meta name="viewport" content="initial-scale=1.0, width=device-width" />
    </Head>
    <h1>首页内容{advs.length}</h1>
    <ul>
      {
        advs.map(adv => {
          return (
            <li key={adv.name}>
              <a href={adv.link}>{adv.name}</a>
            </li>
          )
        })
      }
    </ul>
  </div>
}